import 'package:flutter/material.dart';
class Test_Align extends StatelessWidget {
  const Test_Align({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text('Test_Align'),
      ),
      body: Column(children: [
        Container(
          height: 120.0,
          width: 120.0,
          color: Colors.blue.shade50,
          // 内部有类似于位置计算的逻辑去配置偏移
          child:  Align(
            // alignment: Alignment.center,
            // 说明Alignmeng可以自定义偏移不用预设
            alignment:  Alignment(1.2, 0.0),
            // child: FlutterLogo(
            //   size: 60,
            // ),
            //说明Align不是撑满父组件
            child:Container(child:Text('1'),color: Colors.red),
          ),
        ),
        Container(
          color: Colors.blue.shade50,
          child: const Align(
            widthFactor: 2,
            heightFactor: 2,
            alignment: Alignment.bottomCenter,
            child: FlutterLogo(
              size: 60,
            ),
          ),
        ),
        Container(
          height: 120.0,
          width: 120.0,
          color: Colors.blue.shade50,
          child: const Align(
            // 中心为原点
            alignment: Alignment(2,0),
            child: FlutterLogo(
              size: 60,
            ),
          ),
        ),
        Container(
          height: 120.0,
          width: 120.0,
          color: Colors.blue[50],
          child: const Align(
            // ------------左上角为原点
            alignment: FractionalOffset(0, 0),
            child: FlutterLogo(
              size: 60,
            ),
          ),
        )
      ],)
    );
  }
}
